/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package luft27.comm.mavlink;

/**
 *
 * @author amalikov
 */
public final class Message {
	public Message(byte senderId, byte compId, byte msgId, byte[] payload) {
		this.senderId = senderId;
		this.compId = compId;
		this.msgId = msgId;
		this.payload = payload;
	}
	
	public final byte senderId;
	public final byte compId;
	public final byte msgId;
	public final byte[] payload;
	
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(String.format("mavlink from %d:%d id=%d payload=[", 
				(short)senderId & 0xFF, (short)compId & 0xFF, (short)msgId & 0xFF));
		for (byte p : payload) {
			sb.append(" ");
			sb.append((short)p & 0xFF);
		}
		sb.append(" ]");
		return sb.toString();
	}
}
